﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace C4F.DevKit.Bluetooth.ServiceAndDeviceDiscovery
{
    /// <summary>
    /// Stores the value of an attribute of the service.
    /// </summary>
    [StructLayout(LayoutKind.Explicit)]
    public struct SdpUnion
    {
        /// <summary>
        /// Value for type equals SdpTypeInt, value for specificType
        /// equals SdpStInt128
        /// </summary>
        [FieldOffset(0)]
        public SdpLargeInteger16 Int128Value;
        /// <summary>
        /// Value for type equals SdpTypeInt, value for specificType
        /// equals SdpStInt164.
        /// </summary>
        [FieldOffset(0)]
        public long Int64Value;
        /// <summary>
        /// Value for type equals SdpTypeInt, value for specificType 
        /// equals SdpStInt32.
        /// </summary>
        [FieldOffset(0)]
        public int Int32Value;
        /// <summary>
        /// Value for type equals SdpTypeInt, value for specificType
        /// equals SdpStInt16.
        /// </summary>
        [FieldOffset(0)]
        public short Int16Value;
        /// <summary>
        /// Value for type equals SdpTypeInt, value for specificType
        /// equals SdpStInt8.
        /// </summary>
        [FieldOffset(0)]
        public sbyte Int8Value;
        /// <summary>
        /// Value for type equals SdpTypeUint, value for specificType
        /// equals SdpStUint128.
        /// </summary>
        [FieldOffset(0)]
        public SdpUlargeInteger16 Uint128Value;
        /// <summary>
        /// Value for type equals SdpTypeUint, value for specificType 
        /// equals SdpStUnit64.
        /// </summary>
        [FieldOffset(0)]
        public ulong Uint64Value;
        /// <summary>
        /// Value for type equals SdpTypeUint, value for specificType equals
        /// SdpStUnit32.
        /// </summary>
        [FieldOffset(0)]
        public uint Uint32Value;
        /// <summary>
        /// Value for type equals SdpTypeUint, value for specificType equals
        /// SdpStUnit16.
        /// </summary>
        [FieldOffset(0)]
        public ushort Uint16Value;
        /// <summary>
        /// Value for type equals SdpTypeUint, value for specificType equals
        /// SdpStUnit8.
        /// </summary>
        [FieldOffset(0)]
        public byte Uint8Value;
        /// <summary>
        /// Value for type equals SdpTypeBoolean.
        /// </summary>
        [FieldOffset(0)]
        public byte BooleanValue;
        /// <summary>
        /// Value for type equals SdpTypeUuid, value for specificType equals
        /// SdpStUuid128.
        /// </summary>
        [FieldOffset(0)]
        public Guid Uuid128Value;
        /// <summary>
        /// Value for type equals SdpTypeUuid, value for specificType equals 
        /// SdpStUuid32.
        /// </summary>
        [FieldOffset(0)]
        public uint Uuid32Value;
        /// <summary>
        /// Value for type equals SdpTypeUuid, value for specificType equals 
        /// SdpStUuid16.
        /// </summary>
        [FieldOffset(0)]
        public ushort Uuid16Value;
        /// <summary>
        /// Value for type equals SdpTypeString, which is a raw string buffer. 
        /// </summary>
        [FieldOffset(0)]
        public Sdpstring SdpStringValue;
        /// <summary>
        /// Value for type equals SdpTypeUrl
        /// </summary>
        [FieldOffset(0)]
        public Url UrlValue;
        /// <summary>
        /// Value for type equals SdpTypeSequence
        /// </summary>
        [FieldOffset(0)]
        public Sequence SequenceValue;
        /// <summary>
        /// Value for type equals SdpTypeAlternative
        /// </summary>
        [FieldOffset(0)]
        public Alternative AlternativeValue;
    }
}
